// pages/agent/agent.js
import {Agent} from '../agent/agent-model.js';

var agent = new Agent();

Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		loadingHidden: false,
	},

	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function () {

	},
	onLoad:function(){
		this._checkAgent();
	},

	_checkAgent:function(){
		var result = agent.checkAgent((data)=>{
			this.setData({
				loadingHidden:true,
				totalMoney: data.totalMoney,
				money:data.money,
				checkAgent:data.msg
			});
		});
	},
	toAgent:function(){
		wx.redirectTo({
			url: '../toagent/toagent',
		});
	},
	back:function(){
		wx.navigateBack({});
	}
})